/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.pscu.smadmin.smadmin;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.connection.ConnectionProvider;
import org.hibernate.impl.SessionFactoryImpl;

/**
 *
 * @author Aruna
 */
public class Test {

    public static void main(String[] args) {

        SessionFactory sf = new AnnotationConfiguration().configure().buildSessionFactory();

        ConnectionProvider cp = ((SessionFactoryImpl) sf).getConnectionProvider();
        // DataSource ds = ((DatasourceConnectionProvider) cp).getDataSource();
        Session session = sf.openSession();

        ProcessEngine processEngine = ProcessEngineConfiguration
                .createStandaloneProcessEngineConfiguration()
                .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
                .setJdbcDriver("oracle.jdbc.OracleDriver")
                .setJdbcUrl("jdbc:oracle:thin:@localhost:1521:XE")
                .setJdbcUsername("sankar")
                .setJdbcPassword("sankar")
                .buildProcessEngine();


        //setDataSource(ds).buildProcessEngine();

        RuntimeService rs = processEngine.getRuntimeService();
        
        List<String> varList= new ArrayList<String>();
        varList.add("LIst String 1");

        Map<String, Object> variables = new HashMap<String, Object>();
        variables.put("employeeName", "Kermit");
        variables.put("numberOfDays", varList);
        variables.put("vacationMotivation", "I'm really tired!");


       // ProcessInstance instance = rs.startProcessInstanceByKey("sankarMakerChecker", variables);

       // System.out.println(instance.getProcessInstanceId());

        RepositoryService repo = processEngine.getRepositoryService();
        
        
        System.out.println(rs.getVariables("19601").get("numberOfDays").getClass());
        


    }
}
